import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login'
Vue.use(VueRouter)
// 关闭路由重复报错警告
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

  /*
  * meta  路由元信息
  *  -title 代表面包屑名称
  * */
  const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login,
  },
  {
    path: '/home',
    name: '基础数据',
    component: Home,
    children:[
      {
        path:'/home/jishufangxiang',
        name:'技术方向',
        component:()=> import('../views/Jishufangxiang.vue'),
        meta: { title: '技术方向' }
      },
      {
        path:'/home/chengshiguanli',
        name:'城市管理',
        component:()=> import('../views/Chengshiguanli.vue'),
        meta: { title: '城市管理' }
      },
      {
        path:'/home/koushiguanli',
        name:'口试管理',
        component:()=> import('../views/Koushiguanli.vue'),
        meta: { title: '口试管理' }
      }
    ]
  },
  {
    path:'/',
    redirect:'/login'
  }
]

const router = new VueRouter({
  routes
})

export default router
